package com.zlx.learn.kown.controller;

import com.zlx.learn.kown.entity.Ebook;
import com.zlx.learn.kown.req.EbookReq;
import com.zlx.learn.kown.resp.CommonResp;
import com.zlx.learn.kown.resp.EbookResp;
import com.zlx.learn.kown.service.EbookService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;
@RestController
@RequestMapping("/ebook")
public class EbookController {
    @Resource
    private EbookService ebookService;

    @GetMapping("/list")
        public CommonResp<List<EbookResp>> list(EbookReq ebookReq){
        List<EbookResp> data = ebookService.list(ebookReq);
        // 设置数据
        CommonResp<List<EbookResp>> res = new CommonResp<>();
        res.setData(data);
        res.setSuccess(true);
        res.setMessage("数据返回成功");
        return res;
    }
}
